package util;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

public class HibernateUtil {
	private static SessionFactory sessionFactory;
	static {
		// 1.加载配置
		Configuration configuration = new Configuration().configure();
		// 2.工厂
		sessionFactory = configuration.buildSessionFactory();
	}

	public static Session getCurrentSession() {
		return sessionFactory.getCurrentSession();
	}
}
